<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="javax.sql.*, java.sql.*, com.att.network.acronym.Util" %>
<%@include file="init.jsp" %>
<%
    String ret = "";
    Connection con = null;
    PreparedStatement st = null;
    String q = request.getParameter("q");
    if (q != null) {
        q= q.toUpperCase();
        try {
            con = Util.getCon(db);
            st = con.prepareStatement("SELECT name, text, id from acronym WHERE name=?");
            st.setString(1, q);
            ResultSet rs = st.executeQuery();
            while (rs.next()) {
                ret += "<div> <a href='javascript:void(0)' onclick='del(" + rs.getInt(3) + ", this )' data-mini='true' data-inline='true' data-role='button' data-icon='delete' data-iconpos='notext'>Delete</a>";
                ret += "<span class='name'> " + rs.getString(1) + "</span>" + "<span class='text'>" + rs.getString(2) + "</span> </div>";
            }
        } finally {
            con.close();
        }
        if (ret.length() == 0) {
            ret = "Not found. Please try again!";
        }
    }

    out.println(ret);
%>

